package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "9021000131658210";

	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCnuM9+RyBIKpLnBn8X69Vuf6nxPOU/dpYg5B56qnn0e5TzIpv5YW0NiakiPZ3GQJp2PC6JSJwFp2nazA/q3rPOpRnPJieMOdmxMk+vztaXlNS4dteEof+W4YOGO5A816imgvLTD+P31nnFK5zu0ZBbOKIVVr8kaPtWs5s0r1DiO50KRhJZPPWmXpW0FunVgYGEAX/svDCO63LvALhXP/p05j9JLUV/PVUUps+dubUgHe2Os5/IV/a+7uRvTYrlOeLt6txEnOWKUyHXZ2u2PBWLRrMNYVZqPRwqwos94+Nb96+71OtS4S8Q4V8RSPam1K2Zin1ON1A609a27I11S5KfAgMBAAECggEAMYp3T5d2w5o/thnHJKu2aWMwMV+JX4uJoMGA9z6vszVls8N/StQqQBtvZ/vHRK4EcfQo0sgtvcXLkKNB+GA7wEgoLXXZrKPR13NC8m0oGbIOe0YvNrAbLNgD33xsiGwzFqwLSaih76zcXw8Y1bn059z8k00CPKD9zIhUyeUXARucKsiCuRuwryVjbKC13nvSP8Jdyil0i3Sq12YLxD2AuFfQcdEf7ZZjqHuLwqWwu5uMT5CXTZml7wqvJh5eWx580E2i8U1xZEa3aMTv82i/tDIvMPHTCnZl1sYkXD4GNz17Vu8pRcZSnvVHhPN0Q0NOGz62IFpesAAPvuW8ngTBoQKBgQDYUH3LivN3bvprzIu+a4i+KZ4aWNYdO5a22E/8kFPeGPISR5agA+9NbZqq4mPu7DYrJ3D7uxXFQbx6jr1xZS3hb3VRINw5dAnctWR8O+MbawgT2tQ8cWNTxA7lvY6vZDQ/mERe+2hJhtQUeETtk7PvluDbF1lPICFwQMsLIen95wKBgQDGfhq5hS0yAXX00jKPDtvlxM+bDPdCDILOErYWVa1jMRKpPfota5A9408OaABg6Y2s1SulKP2yUCVl7PlOuO11Rv1XvJ9xbUaMyj/COBVilkm9EeZQbUKfaol/irjiHivgpcQ6EqhC93kJ0i+HLJPbTwKXCex8D5QRC37NGa1+iQKBgCdoCnKhHpdcZUxsF+0Zo/CYnk/IbUEoEN3AbFnjZRPp0XeZCQyfiuG9HNcSpQfqije0WLXTMDUeM5rUFBjrSL9v0Zx08wmYZQ+LEAI92rKs/ey4Cb/1HBYvelNKBAtZotcPAy2WeToj0NDl1BC/vqDgCJiBGWj7vnu3ogWmKP1zAoGAZcbbZS0IU4+0L+hnzDrOPi6AVPx8+/z2RTwK6cDcuvO6odUJpqh0uYcITla9evPGlUxoqLMwAnJd+rlbzCW+fFf+JzKsfriNaDt8HdYsAPUWsj+vXKXpd1xlTGSREEBwNyxIRY6zgELsaUDA5grRda45ocCQ5bwHLAY86mW0NCECgYEA1J/N22F1Fh03hX43vVLPYvzuWzQHsBeElzz9aegwLgfjA5Yjyb7o8OQxg0mOC0BYdr4S1UL4vqODBZoQT48ZV4qu5NpKMD0LoB9p0+SA+G0vyEPh5+lC3OvH2n/lZrcvZQxCvN7lmePkMGWDLD8dtyLtTjrqkR3plNrIYRDDlHc=";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkQuurXH4ecmgRWEE/7dDDlHktZY9aKBC61VZ3jqqjKF+EjbqIaPKKSHPC2Td0+0Ex19kQqa6w94O2vknh4BzX1tYlhX6A6pabv+DiepyIo22jqGJ5HMd6t9l8uMdVH+hnAOWvi1DCYIdlP/I+AIjOs295vFXu3y98QiUVSyf4rx79zc2uRXlrO92u8hdw7/0fVOOnNndQJiMDL5JQGup7stBtWrjiAGm1QKBF6UT69CKEAN2qhfrqulYEGdzkPK6ERXvXb/ADwHe9pR32aw0dgb/MOE6gNm8bbWXLj7ZQ4ZOl3tWVqubrgy6gQW1AF8SBjhFxGazf8X6X+9K8hGwxwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    // 异步地址
	public static String notify_url = "http://alipaydemo.free.idcfengye.com/alipay_demo_war_exploded/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    // 支付宝支付成功跳转的地址
	public static String return_url = "http://alipaydemo.free.idcfengye.com/alipay_demo_war_exploded/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

